﻿@model Wedn.Net.Model.View.LoginUser
@{Layout = "~/Areas/Admin/Views/Shared/_BaseLayout.cshtml";}
<div class="mainContainer">
    <div class="loginWrap">
        <img src="/content/images/loginLogo.png">
        <div class="loginContainer">
            <div class="loginHeader">
                <h5><img src="/content/images/icons/14x14/lock3.png"> @Parse("Login")</h5>
                <ul class="titleButtons">
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#"><img src="/content/images/icons/14x14/cog2.png"></a>
                        <ul class="dropdown-menu pull-right">
                            <li><a href="#">@Parse("Forgot_password")</a></li>
                            <li><a href="#">@Parse("Register")</a></li>
                            @*<li><a href="#">Contact support</a></li>*@
                        </ul>
                    </li>
                </ul>
            </div>
            @*<form action="" method="post"id = "validateLogin"></form>*@
            @using (Ajax.BeginForm("Index", "Login", null, new AjaxOptions() { HttpMethod = "Post", OnSuccess = "afterLogin" }, new { id = "login_form" }))
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)
                @*<label for="username">@Parse("Username")</label>*@
                @Html.LabelFor(u => u.Username, Parse("Username"))
                <div class="inputField">
                    @Html.TextBoxFor(u => u.Username, new { placeholder = Parse("Username")})
                    @Html.ValidationMessageFor(u => u.Username, Parse("username_is_required"))
                    <img src="/content/images/icons/14x14/member2.png">
                </div>
                @*<label for="password">@Parse("Password")</label>*@
                @Html.LabelFor(u => u.Username, Parse("Password"))
                <div class="inputField">
                    @Html.PasswordFor(u => u.Password, new { placeholder = Parse("Password") })
                    @Html.ValidationMessageFor(u => u.Password, Parse("password_is_required"))
                    <img src="/content/images/icons/14x14/lock3.png">
                </div>
                <div class="checkX">
                    <label class="formButton">
                        @Html.CheckBoxFor(u => u.IsChecked)
                        @*<input type="checkbox" name="check" checked>*@ <span>@Parse("Remember_me")</span>
                    </label>
                </div>
                @Html.HiddenFor(u => u.Redirect)
                <button type="submit" class="button noMargin sButton blockButton bOlive">@Parse("Login")</button>
            }
        </div>
    </div>
</div>
@section Scripts{
    <script src="~/Content/Scripts/unobtrusive/jquery.unobtrusive-ajax.js"></script>
    <script src="~/Content/Scripts/unobtrusive/jquery.validate.unobtrusive.js"></script>
    <script>
        function afterLogin(data) {
            //var data = $.parseJSON(res);
            switch (data.Result) {
                case 'Success':
                    window.location.href = data.Redirect;
                    break;
            }
        }
    </script>
}